package com.jt.redis.resource.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class LogAspect {
    @Pointcut("@annotation(com.jt.redis.resource.annotation.RequiredLog)")
    public void doLog(){}
    @Around("doLog()")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        log.debug("before {}", System.currentTimeMillis());
        Object result = joinPoint.proceed();
        log.debug("after {}", System.currentTimeMillis());
        return result;
    }
}
